Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

fix(scope): Scope.runAsync in digest and flush #1005

Closed
wants to merge 2 commits into from

Conversation

jbdeboer
Copy link
Contributor

@jbdeboer jbdeboer commented May 6, 2014

No description provided.

@jbdeboer jbdeboer added cla: yes and removed cla: no labels May 6, 2014
_zone.onTurnDone = () {
apply();
// Do not leave any microtasks behind.
assert(_runAsyncHead == null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to the assert phase?

@mhevery
Copy link
Contributor

mhevery commented May 7, 2014

Per our conversation can we have a different API for runAsync which runs in digest vs the one which runs in flush phase?

Perhaps runAsync and runAsyncFlush?

mvuksano and others added 2 commits May 15, 2014 16:28
BREAKING CHANGE:

Previously a micro task registered in flush phase would cause a new
digest cycle after the current digest cycle. The new behavior
will cause an error.

Closes dart-archive#984
BREAKING CHANGE:

Microtasks scheduled in flush will trigger a new digest+flush cycle.

Microtasks scheduled in digest will be executed in digest, counting
towards the ScopeDigestTTL.
@jbdeboer
Copy link
Contributor Author

jbdeboer commented Jun 8, 2014

This PR fixes a bug where a microtask scheduled from inside of Scope.apply() will trigger another complete Scope.apply(). It should only trigger another digest loop or another flush.

We patched this change into real applications and saw actions that originally had ~30 flushes drop to ~20. However, we were not able to see any significant performance gains as measured in wall-time. Applications which track the number of flushes are nevertheless nervous about this bug.

This PR changes the life-cycle of the application is subtle ways which are difficult to debug. I feel that we need to land Scope.apply() debugging, e.g. #1114 before we are able to land this PR.

@mhevery
Copy link
Contributor

mhevery commented Jun 10, 2014

I am looking into this again. I don't think the above code is right as it loops over apply.

@mhevery
Copy link
Contributor

mhevery commented Jun 10, 2014

Replaced by #1140

@mhevery mhevery closed this Jun 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

4 participants